﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace FlanProject.ScreenMenu
{
	class IntroductionScreen : InterfaceScreen
	{
		#region Attributs
		private PopupComponent text;
        private Rectangle windowSize;
		#endregion

		public IntroductionScreen(String saveName)
		{
			this.filesName = saveName;
		}

		public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager cm)
		{
            var stringBuilder = new StringBuilder();
            stringBuilder.AppendLine("A thousand years into the future, a man speaks to his grand-son.");
            stringBuilder.AppendLine("- Pay attention to what I'm about to say ...");
            stringBuilder.AppendLine("- Many people died for the secrets you're going to hear.");
            stringBuilder.AppendLine("He remains silent for a few seconds, and then, starts telling his story.");
            
            this.text = new PopupComponent(stringBuilder.ToString(), 12, new Vector2(25, 120));
			this.text.LoadContent(cm);
			this.text.Visible = true;
			this.text.BackgroundColor = Color.Transparent;
			this.text.ForegroundColor = Color.Yellow;

			this.windowSize = new Rectangle(
				FlanProject.Instance.GraphicsDevice.Viewport.X,
				FlanProject.Instance.GraphicsDevice.Viewport.Y,
				FlanProject.Instance.GraphicsDevice.Viewport.Width,
				FlanProject.Instance.GraphicsDevice.Viewport.Height);

			base.LoadContent(cm);
		}

		public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
		{
			// Set the background color
			if (this.text != null)
			{
				FlanProject.Instance.GraphicsDevice.Clear(Color.Black);
				this.text.Draw(sb);
			}
			base.Draw(sb);
		}

		public override void Update()
		{
			this.text.Update();
			if (text.IsExiting)
			{
				this.IsLoadingGame = true;
				this.text = null;
			}
			//base.Update();
		}
	}
}
